package com.feature.shop.user.api.enums;

/***
 * 
 * 菜单表typeEnum
 */
public enum ShopMenuTypeEnum {
    MENU(0, "菜单"), BUTTON(1, "按钮");

    private Integer id;

    private String text;

    ShopMenuTypeEnum(Integer id, String text) {
        this.id = id;
        this.text = text;
    }

    public String getText() {
        return this.text;
    }

    public Integer getId() {
        return this.id;
    }

    public static Integer getIdByText(String text) {
        for (ShopMenuTypeEnum methodEnum : ShopMenuTypeEnum.values()) {
            if (methodEnum.getText().equals(text)) {
                return methodEnum.getId();
            }
        }
        return null;
    }

    public static String getTextById(int id) {
        for (ShopMenuTypeEnum values : ShopMenuTypeEnum.values()) {
            if (values.id == id) {
                return values.text;
            }
        }
        return "";
    }
}
